package com.lab303.powerproject.controller;

import com.lab303.powerproject.entity.Device;
import com.lab303.powerproject.service.DeviceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;

@Controller
public class PageController {

    @Autowired
    private DeviceService deviceService;

    @GetMapping("/device.html")
    public String loadDevicePage(Model model){
        List<Device> deviceList = deviceService.getAllDevices();
        model.addAttribute("deviceList",deviceList);
        return "device";
    }
}
